/*
四种变量声明方式
https://www.bilibili.com/video/BV1gf4y1r79E/?p=5&spm_id_from=pageDriver&vd_source=8bd7b24b38e3e12c558d839b352b32f4
*/
package main

import "fmt"

func main() {
	// 1. 如果不初始化，默认值是0。
	var a int
	fmt.Println(a)
	fmt.Printf("type of a = %T\n", a)

	// 2. 给初始化值
	var b int = 100
	fmt.Println(b)
	fmt.Printf("type of b = %T\n", b)

	var bs string = "hello, world"
	fmt.Println(bs)
	fmt.Printf("type of bs = %T\n", bs)

	// 3. 初始化的时候省去数据类型
	var c = 100
	fmt.Println(c)
	fmt.Printf("type of c = %T\n", c)

	var cs = "hello, world cs"
	fmt.Println(cs)
	fmt.Printf("type of cs = %T\n", cs)

	// 4. 最常用的方法：省去var直接自动匹配
	// 注意不可以用:=来声明全局变量
	d := "hello, world d"
	fmt.Println(d)
	fmt.Printf("type of d = %T\n", d)

	di := 100
	fmt.Println(di)
	fmt.Printf("type of di = %T\n", di)

	df := 3.14
	fmt.Println(df)
	fmt.Printf("type of df = %T\n", df)

	// ///////////////////////////////////////
	// 声明多个变量
	var xx, yy int = 100, 200
	fmt.Printf("%d, %d\n", xx, yy)
	var kk, ll = 100, "hey"
	fmt.Printf("%d, %s\n", kk, ll)

	var (
		vv int  = 100
		jj bool = true
	)
	fmt.Printf("%d, %t", vv, jj)

}
